using UnityEngine;
using UnityEngine.UI;

public class BallInHand : MonoBehaviour
{
	[HideInInspector]
	public Color color;

	[SerializeField]
	private Image m_Image;

	[SerializeField]
	private Animator m_Animator;

	public void Show()
	{
		m_Animator.SetTrigger("Show");
	}

	public void Hide()
	{
		m_Animator.SetTrigger("Hide");
	}

	public void Locate(Vector3 position)
	{
		base.transform.position = MathTools.World2UI(position);
	}

	private void LateUpdate()
	{
		Locate(Pools.CueBall.transform.position);
	}

	public void ChangeState(int state)
	{
		if (state == 1)
		{
			iTween.ColorTo(m_Image.gameObject, Color.red, 0.2f);
		}
		else
		{
			iTween.ColorTo(m_Image.gameObject, Color.white, 0.2f);
		}
	}
}
